<template>
  <div class="app-container">
    <eHeader :param-bean="paramBean" :sup_this="sup_this" />
    <eForm ref="form" :sup_this="sup_this" />
    <!--表格渲染-->
    <DataGridTable
      v-loading="loading"
      ref="mainTable"
      :sup_this="sup_this"
      :data="data.rtnList"
      :max-height="gridMaxHeight"
      :total="total"
      :all-define-columns="['cpyName','cpyLongName','cpyType','cerCode','thirdCode','cpyOwnerType','bankAccount','bankName','officeAddress','recAddress','mainContacor','mobile','telphone','email','cpyUrl','lastUpdateDate',]"
      grid-id="customSupplyMngProcessGridId"
      @selection-change="handleGridSelectionChange">
      <DataGridColumnSlot prop="cpyCode" label="公司编号">
        <template slot-scope="scope">
          <edit :data="scope.row" :sup_this="sup_this" />
        </template>
      </DataGridColumnSlot>
      <DataGridColumn slot="cpyName" prop="cpyName" label="简写" />
      <DataGridColumn slot="cpyLongName" prop="cpyLongName" label="公司完整名称" />
      <DataGridColumnSlot slot="cpyType" prop="cpyType" label="公司类型" align="center">
        <template slot-scope="scope">
          <template v-for="item in dicts.cpy_type">
            <span v-if="scope.row.cpyType.toString() === item.dictCode" :key="item.id">{{ item.dictName }}</span>
          </template>
        </template>
      </DataGridColumnSlot>
      <DataGridColumn slot="cerCode" prop="cerCode" label="证书编号" />
      <DataGridColumnSlot slot="cpyOwnerType" prop="cpyOwnerType" label="类型" align="center">
        <template slot-scope="scope">
          <template v-for="item in dicts.cpy_owner_type">
            <el-tag v-if="scope.row.cpyOwnerType.toString() === item.dictCode" :type="item.attribute1" :key="item.id">{{ item.dictName }}</el-tag>
          </template>
        </template>
      </DataGridColumnSlot>
      <DataGridColumn slot="bankAccount" prop="bankAccount" label="银行账号" />
      <DataGridColumn slot="bankName" prop="bankName" label="银行名称称" />
      <DataGridColumn slot="officeAddress" prop="officeAddress" label="办公地址" />
      <DataGridColumn slot="recAddress" prop="recAddress" label="收货地址" />
      <DataGridColumn slot="mainContacor" prop="mainContacor" label="主要联系人" />
      <DataGridColumn slot="mobile" prop="mobile" label="手机号" />
      <DataGridColumn slot="telphone" prop="telphone" label="电话" />
      <DataGridColumn slot="email" prop="email" label="邮件地址" />
      <DataGridColumn slot="cpyUrl" prop="cpyUrl" label="公司官网" />
      <DataGridColumnSlot slot="lastUpdateDate" prop="lastUpdateDate" label="最后更新时间" >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lastUpdateDate) }}</span>
        </template>
      </DataGridColumnSlot>
    </DataGridTable>
  </div>
</template>

<script>
import checkPermission from '@/utils/permission'
import { parseTime } from '@/utils/index'
import eHeader from './module/header'
import edit from './module/edit'
import eForm from './module/form'
import initData from '@/mixins/initData'
import customSupply from '@/api/base/CustomSupply'

export default {
  components: { eHeader, eForm, edit },
  mixins: [initData],
  dictTypes: ['cpy_owner_type', 'cpy_type'],
  props: {
  },
  data() {
    return {
      delLoading: false,
      sup_this: this
    }
  },
  created() {
    this.url = customSupply.loadDataUrl()
    this.$nextTick(() => {
      this.init()
    })
  },
  mounted() {
  },
  methods: {
    parseTime,
    checkPermission,
    async beforeInit() {
      return true
    }
  }
}
</script>
